home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 121
/
FreelogMagazineJuilletAout2014-No121.iso
/
Outils
/
Adobe-Air
/
adobe-air_13.exe
/
[0]
/
setup.swf
/
scripts
/
mx
/
accessibility
/
ButtonAccImpl.as
< prev
next >
Wrap
Text File
|
2014-03-27
|
3KB
|
103 lines
package mx.accessibility
{
import flash.accessibility.Accessibility;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import mx.controls.Button;
import mx.core.UIComponent;
import mx.core.mx_internal;
use namespace mx_internal;
public class ButtonAccImpl extends AccImpl
{
private static const EVENT_OBJECT_STATECHANGE:uint = 32778;
private static const STATE_SYSTEM_PRESSED:uint = 8;
private static var accessibilityHooked:Boolean = hookAccessibility();
private static const EVENT_OBJECT_NAMECHANGE:uint = 32780;
mx_internal static const VERSION:String = "3.0.0.0";
public function ButtonAccImpl(param1:UIComponent)
{
super(param1);
role = 43;
}
mx_internal static function createAccessibilityImplementation(param1:UIComponent) : void
{
param1.accessibilityImplementation = new ButtonAccImpl(param1);
}
private static function hookAccessibility() : Boolean
{
Button.createAccessibilityImplementation = mx_internal::createAccessibilityImplementation;
return true;
}
public static function enableAccessibility() : void
{
}
override protected function eventHandler(param1:Event) : void
{
switch(param1.type)
{
case "click":
Accessibility.sendEvent(master,0,EVENT_OBJECT_STATECHANGE);
Accessibility.updateProperties();
break;
case "labelChanged":
Accessibility.sendEvent(master,0,EVENT_OBJECT_NAMECHANGE);
Accessibility.updateProperties();
}
}
override protected function getName(param1:uint) : String
{
var _loc2_:String = Button(master).label;
return _loc2_ != null && _loc2_ != "" ? _loc2_ : "";
}
override public function get_accState(param1:uint) : uint
{
var _loc2_:uint = getState(param1);
if(Button(master).selected)
{
_loc2_ |= STATE_SYSTEM_PRESSED;
}
return _loc2_;
}
override public function accDoDefaultAction(param1:uint) : void
{
var _loc2_:KeyboardEvent = null;
if(master.enabled)
{
_loc2_ = new KeyboardEvent(KeyboardEvent.KEY_DOWN);
_loc2_.keyCode = Keyboard.SPACE;
master.dispatchEvent(_loc2_);
_loc2_ = new KeyboardEvent(KeyboardEvent.KEY_UP);
_loc2_.keyCode = Keyboard.SPACE;
master.dispatchEvent(_loc2_);
}
}
override protected function get eventsToHandle() : Array
{
return super.eventsToHandle.concat(["click","labelChanged"]);
}
override public function get_accDefaultAction(param1:uint) : String
{
return "Press";
}
}
}